package com.windward.vii.dao.mapper;

import com.windward.vii.dao.entity.AssetUserIncome;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AssetUserIncomeMapper {
    @Delete({
        "delete from asset_user_income",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into asset_user_income (id, uid, org_id, ",
        "consumer_uid, type, ",
        "coin, create_time, ",
        "chat_id, gift_id)",
        "values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT}, ",
        "#{consumerUid,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, ",
        "#{coin,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{chatId,jdbcType=BIGINT}, #{giftId,jdbcType=BIGINT})"
    })
    int insert(AssetUserIncome record);

    int insertSelective(AssetUserIncome record);

    @Select({
        "select",
        "id, uid, org_id, consumer_uid, type, coin, create_time, chat_id, gift_id",
        "from asset_user_income",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    AssetUserIncome selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AssetUserIncome record);

    @Update({
        "update asset_user_income",
        "set uid = #{uid,jdbcType=BIGINT},",
          "org_id = #{orgId,jdbcType=BIGINT},",
          "consumer_uid = #{consumerUid,jdbcType=BIGINT},",
          "type = #{type,jdbcType=TINYINT},",
          "coin = #{coin,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "chat_id = #{chatId,jdbcType=BIGINT},",
          "gift_id = #{giftId,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(AssetUserIncome record);
}